﻿package mortal.game.view.palyer.view
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import com.gengine.resource.*;
    import com.gengine.utils.*;
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.greensock.layout.*;
    import com.mui.controls.*;
    import com.mui.manager.*;
    import com.mui.utils.*;
    import extend.language.*;
    import fl.data.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.utils.*;
    import frEngine.primitives.object2d.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.common.net.*;
    import mortal.common.swfPlayer.*;
    import mortal.component.rotate3dModelSprite.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.manager.window3d.*;
    import mortal.game.model.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.player.type.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.cd.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.guide.data.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.common.tooltip.*;
    import mortal.game.view.guide.*;
    import mortal.game.view.mount.data.*;
    import mortal.game.view.palyer.*;
    import mortal.game.view.palyer.data.*;
    import mortal.game.view.palyer.renderer.*;
    import mortal.game.view.palyer.util.*;
    import mortal.game.view.shop.*;
    import mortal.game.view.shopMall.data.*;
    import mortal.game.view.skill.*;
    import mortal.game.view.systemSetting.*;
    import mortal.game.view.wizard.panel.*;
    import mortal.mvc.core.*;

    public class FashionPanelBase extends PlayerPanelBase
    {
        protected var _bg:GBitmap;
        protected var _skillList:GTileList;
        protected var _combat:BitmapNumberText;
        protected var _attrList:GTileList;
        protected var _activeBtn:GLoadingButton;
        protected var _levelSpr:GSprite;
        protected var _levelImg:GImageBitmap;
        protected var _levelTxt:GTextFiled;
        protected var _currCombatTxt:GImageBitmap;
        protected var _hideBox:GCheckBox;
        protected var _skillLabel:GImageBitmap;
        protected var _growthItem:BaseItem;
        protected var _talentItem:BaseItem;
        protected var _equipList:GTileList;
        protected var _fashionGrowthUseBtn:GLoadedButton;
        protected var _fashionTalentUseBtn:GLoadedButton;
        protected var _vipSpr:ToolTipSprite;
        protected var _vipIcon:GImageBitmap;
        protected var _fashionName:GTextFiled;
        protected var _turnLeftBtn:GLoadedButton;
        protected var _turnRightBtn:GLoadedButton;
        protected var _leftEquipBg:GImageBitmap;
        protected var _rightEquipBg:GImageBitmap;
        protected var _sharpBtn:GLoadingButton;
        protected var _advanceTitle:GImageBitmap;
        protected var _progressBar:BaseProgressBar;
        protected var _consumeStuffTxt:GTextFiled;
        protected var _consumeStuffName:GTextFiled;
        protected var _consumeItem:BaseItem;
        protected var _consumeNum:GTextFiled;
        protected var _commonAdvanceBtn:GLoadingButton;
        protected var _autoAdvanceBtn:GLoadingButton;
        protected var _cancelBtn:GLoadingButton;
        protected var _autoBuy:GCheckBox;
        protected var _levelUpArrow:GImageBitmap;
        protected var _equipSpr:GSprite;
        protected var _unActiveTxt:GImageBitmap;
        protected var _arrow:SWFPlayer;
        protected var _currAttrTxt:GImageBitmap;
        protected var _advanceLevelBg1:GImageBitmap;
        protected var _advanceLevelBg2:GImageBitmap;
        protected var _advanceArrow:GImageBitmap;
        protected var _currLevel:BitmapNumberText;
        protected var _nextLevel:BitmapNumberText;
        protected var _advanceInfoSpr:GSprite;
        protected var _beforeAdvance:GImageBitmap;
        protected var _afterAdvance:GImageBitmap;
        protected var _currLevelName:GTextFiled;
        protected var _nextLevelName:GTextFiled;
        protected var _upCombatArrow:GBitmap;
        protected var _upCombat:GTextFiled;
        protected var _growthOpenTip:GTextFiled;
        protected var _talentOpenTip:GTextFiled;
        protected var _modelTurnLeftBtn:GLoadedButton;
        protected var _modelTurnRightBtn:GLoadedButton;
        protected var _fullLevelTip:GTextFiled;
        protected var _servenActivitiesBtn:GLoadingButton;
        protected var _consumeBagNum:GTextFiled;
        protected var _fashionSharpEquip:OtherEquipItem;
        protected var _wardrobeEnterBtn:GLoadingButton;
        protected var _rect3d:Rect3DObject;
        protected var _img2d:Img2D;
        protected var _roleModelPlayer:UserModelPlayer;
        protected var _nextModelPlayer:UserModelPlayer;
        protected var _rotate3d:Rotate3dModelSprite;
        protected var _fightSoulEffectPlayer:EffectPlayer;
        protected var _fightSoulModelPlayer:ActionPlayer;
        protected var _nextFightSoulEffectPlayer:EffectPlayer;
        protected var _nextFightSoulModelPlayer:ActionPlayer;
        protected var _fashionType:int;
        protected var _data:FashionAdvanceData;
        protected var _currAdvanceAttrData:Array;
        protected var _currSelCode:int;
        protected var _isAddArrow:Boolean;
        protected var _timeoutNum:uint;
        protected var _isMouseOver:Boolean;
        protected var _isFashionFullLevel:Boolean;
        private var _scale9gridImg2d:Scale9GridImg2DEx;
        private var _isRightTop:Boolean;
        private var _cdData:ICDData;
        private var _cdType:String;
        protected var _isAutoAdvance:Boolean = false;
        protected var _callLaterId:int;
        protected var _isStopAdvance:Boolean;
        protected var _isCommonAdvance:Boolean;

        public function FashionPanelBase(param1:Window)
        {
            this._currAdvanceAttrData = [];
            super(param1);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gBitmap("");
            this._rotate3d = UIFactory.getUICompoment(Rotate3dModelSprite, 0, 70, _window.contentTopOf3DSprite);
            this._rotate3d.setSize(486, 380);
            this.createChildren();
            LoaderManager.instance.load(getBgName(this._fashionType) + ".swf", this.onBgLoadCompl);
            return;
        }// end function

        protected function createChildren() : void
        {
            pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.mountTitleBg, 7, 33, _window.contentTopOf3DSprite));
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.size = 16;
            _loc_1.align = AlignMode.CENTER;
            this._fashionName = UIFactory.gTextField("", 208 - 83 + 5, 42 - 2, 243, 30, _window.contentTopOf3DSprite, _loc_1);
            this._turnLeftBtn = UIFactory.gLoadedButton(ImagesConst.MountLeft_upSkin, 61, 34, 33, 37, _window.contentTopOf3DSprite);
            this._turnRightBtn = UIFactory.gLoadedButton(ImagesConst.MountRight_upSkin, 409, 34, 33, 37, _window.contentTopOf3DSprite);
            this._turnLeftBtn.configEventListener(MouseEvent.CLICK, this.onTurnPageClick);
            this._turnRightBtn.configEventListener(MouseEvent.CLICK, this.onTurnPageClick);
            this._sharpBtn = UIFactory.gLoadingButton(ResFileConst.TurnedBtn, 425, 80, 49, 52, _window.contentTopOf3DSprite);
            this._sharpBtn.visible = false;
            this._sharpBtn.drawNow();
            this._sharpBtn.configEventListener(MouseEvent.CLICK, this.onChangeClick);
            this._equipSpr = UICompomentPool.getUICompoment(GSprite);
            _window.contentTopOf3DSprite.addChild(this._equipSpr);
            this._leftEquipBg = UIFactory.gImageBitmap(ImagesConst.MountEquipBg, 16 + 4, 167 + 30 - 2, this._equipSpr);
            this._rightEquipBg = UIFactory.gImageBitmap(ImagesConst.MountEquipBg, 405 + 15, 167 + 30 - 2, this._equipSpr);
            this._equipList = UIFactory.tileList(27 + 2 + 3, 215 - 25 + 30, 802, 124, this._equipSpr);
            this._equipList.columnWidth = 400;
            this._equipList.rowHeight = 61;
            this._equipList.horizontalGap = 0;
            this._equipList.verticalGap = 0;
            this._equipList.setStyle("skin", new Bitmap());
            this._equipList.setStyle("cellRenderer", FashionEquipCellRenderer);
            this._growthItem = UICompomentPool.getUICompoment(BaseItem);
            this._growthItem.setItemStyle(ItemStyleConst.Small, ImagesConst.FashionEquipBg, 9, 9);
            this._growthItem.x = 27 - 3 + 5;
            this._growthItem.y = 324 - 30 + 80 - 27;
            this._growthItem.isDragAble = false;
            this._equipSpr.addChild(this._growthItem);
            this._growthItem.isGray = true;
            this._growthItem.isShowColorBg = false;
            this._growthItem.isSHowQuality = false;
            this._growthOpenTip = UIFactory.gTextField(Language.getString(41291), 20 + 4 + 5, 430 - 27, 70, 20, this._equipSpr, GlobalStyle.textFormatHui);
            this._talentItem = UICompomentPool.getUICompoment(BaseItem);
            this._talentItem.setItemStyle(ItemStyleConst.Small, ImagesConst.FashionEquipBg, 9, 9);
            this._talentItem.x = 413 + 3 + 13;
            this._talentItem.y = 324 - 30 + 80 - 27;
            this._talentItem.isDragAble = false;
            this._equipSpr.addChild(this._talentItem);
            this._talentItem.isGray = true;
            this._talentItem.isShowColorBg = false;
            this._talentItem.isSHowQuality = false;
            this._talentOpenTip = UIFactory.gTextField(Language.getString(41292), 412 + 4 + 13, 430 - 27, 70, 20, this._equipSpr, GlobalStyle.textFormatHui);
            this._fashionGrowthUseBtn = UIFactory.gLoadedButton(ImagesConst.sub4_upSkin, 44 + 9 + 19 - 6 + 4, 353 - 70 + 5 + 30 + 49 - 26, 18, 18, this._equipSpr);
            this._fashionGrowthUseBtn.configEventListener(MouseEvent.CLICK, this.useItemHandler);
            this._fashionGrowthUseBtn.visible = false;
            this._fashionTalentUseBtn = UIFactory.gLoadedButton(ImagesConst.sub4_upSkin, 268 + 3 + 191 - 4 + 14, 353 - 70 + 5 + 30 + 49 - 26, 18, 18, this._equipSpr);
            this._fashionTalentUseBtn.configEventListener(MouseEvent.CLICK, this.useItemHandler);
            this._fashionTalentUseBtn.visible = false;
            this._beforeAdvance = UIFactory.gImageBitmap(ImagesConst.BeforeAdvance, 6 + 4, 170, _window.contentTopOf3DSprite);
            this._beforeAdvance.visible = false;
            this._afterAdvance = UIFactory.gImageBitmap(ImagesConst.AfterAdvance, 415, 170, _window.contentTopOf3DSprite);
            this._afterAdvance.visible = false;
            this._currLevelName = UIFactory.gTextField("", 34 + 2 + 4, 240, 30, 188, _window.contentTopOf3DSprite, GlobalStyle.textFormatBai.setSize(21));
            this._currLevelName.multiline = true;
            this._currLevelName.wordWrap = true;
            this._currLevelName.textColor = 16775623;
            this._currLevelName.visible = false;
            this._nextLevelName = UIFactory.gTextField("", 442 + 2, 240, 30, 188, _window.contentTopOf3DSprite, GlobalStyle.textFormatBai.setSize(21));
            this._nextLevelName.multiline = true;
            this._nextLevelName.wordWrap = true;
            this._nextLevelName.textColor = 16775623;
            this._nextLevelName.visible = false;
            this._modelTurnRightBtn = UIFactory.gLoadedButton(ImagesConst.TurnRight2_upSkin, 135 + 3, 406, 40, 36, this._equipSpr);
            this._modelTurnRightBtn.configEventListener(MouseEvent.MOUSE_DOWN, this.onClickTurnBtn);
            this._modelTurnRightBtn.configEventListener(MouseEvent.MOUSE_UP, this.stopTurning);
            this._modelTurnLeftBtn = UIFactory.gLoadedButton(ImagesConst.TurnLeft2_upSkin, 332, 406, 40, 36, this._equipSpr);
            this._modelTurnLeftBtn.configEventListener(MouseEvent.MOUSE_DOWN, this.onClickTurnBtn);
            this._modelTurnLeftBtn.configEventListener(MouseEvent.MOUSE_UP, this.stopTurning);
            this._skillLabel = UIFactory.gImageBitmap("", 212 + 4 + 3, 429 + 32, _window.contentTopOf3DSprite);
            this._skillList = UIFactory.tileList(12 - 3 - 4 + 92 - 6, 414 - 26 + 121, 374, 46 + 5, _window.contentTopOf3DSprite);
            this._skillList.columnWidth = 48;
            this._skillList.rowHeight = 47;
            this._skillList.horizontalGap = 8;
            this._skillList.verticalGap = 0;
            this._skillList.setStyle("skin", new Bitmap());
            this._skillList.setStyle("cellRenderer", SkillListCellRenderer);
            this._levelUpArrow = UIFactory.gImageBitmap(ImagesConst.MountLevelUpIcon, 195, 277, _window.contentTopOf3DSprite);
            this._levelUpArrow.visible = false;
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.AdvanceInfoBg, (503 - 1), 38 - 5 + 2, this));
            this._levelSpr = UICompomentPool.getUICompoment(GSprite);
            this._levelSpr.x = 567;
            this._levelSpr.y = 50 - 58 + 52 - 5;
            this.addChild(this._levelSpr);
            this._levelImg = UIFactory.gImageBitmap("", 0, -2, this._levelSpr);
            this._levelTxt = UIFactory.gTextField("", 64, (0 - 1), 258, 25, this._levelSpr, GlobalStyle.textFormatBai.setSize(16).setBold(true));
            this._currCombatTxt = UIFactory.gImageBitmap("", 327 + 3 - 3 + 222 + 45, 150 - 58 - 10, _window.contentTopOf3DSprite);
            this._combat = UIFactory.bitmapNumberText(364 + 2 - 3 + 222 + 30 + 15, 106 - 58 + 60, "WizardCombatNum.png", 23, 30, -3, _window.contentTopOf3DSprite, 13, BitmapNumberText.Mid);
            this._upCombatArrow = UIFactory.gBitmap(ImagesConst.upgradeArrow, 680 + 5, 113, this);
            this._upCombatArrow.visible = false;
            this._upCombat = UIFactory.gTextField("", 694 + 5, 113 - 7, 65, 25, this, GlobalStyle.textFormatLv.setSize(14));
            this._upCombat.visible = false;
            this._currAttrTxt = UIFactory.gImageBitmap("", 560 + 9, 195 - 32, this);
            this._attrList = UIFactory.tileList(497, 195, 270, 150, _window.contentTopOf3DSprite);
            this._attrList.columnWidth = 134;
            this._attrList.rowHeight = 24;
            this._attrList.horizontalGap = 0;
            this._attrList.verticalGap = 0;
            this._attrList.setStyle("skin", new Bitmap());
            this._attrList.setStyle("cellRenderer", ClothWingAttrCellRenderer);
            this._advanceTitle = UIFactory.gImageBitmap("", 595 + 8, 360 - 3 + 2, _window.contentTopOf3DSprite);
            this._advanceInfoSpr = UICompomentPool.getUICompoment(GSprite);
            _window.contentTopOf3DSprite.addChild(this._advanceInfoSpr);
            this._advanceLevelBg1 = UIFactory.gImageBitmap(ImagesConst.SystemAdvanceBg, 559, 387, this._advanceInfoSpr);
            this._advanceLevelBg2 = UIFactory.gImageBitmap(ImagesConst.SystemAdvanceBg, 654, 387, this._advanceInfoSpr);
            this._advanceArrow = UIFactory.gImageBitmap(ImagesConst.SystemAdvanceArrow, 607, (395 - 1), this._advanceInfoSpr);
            this._currLevel = UIFactory.bitmapNumberText(572 + 8, 396 - 2, "GuildNewBuildingNum2.png", 21, 24, -10, this._advanceInfoSpr, 13, 1);
            this._nextLevel = UIFactory.bitmapNumberText(653 + 22, 396 - 2, "GuildNewBuildingNum2.png", 21, 24, -10, this._advanceInfoSpr, 13, 1);
            this._unActiveTxt = UIFactory.gImageBitmap(ImagesConst.FashionText_UnActive, 559 - 33, 403, _window.contentTopOf3DSprite);
            this._unActiveTxt.visible = false;
            var _loc_2:* = GlobalStyle.textFormatAnHuan.center();
            _loc_2.size = 14;
            _loc_2.bold = true;
            this._fullLevelTip = UIFactory.gTextField("", 559 - 33 + 4, 403 - 10, 203, 25, this, _loc_2);
            this._progressBar = UICompomentPool.getUICompoment(BaseProgressBar);
            this._progressBar.x = 8 + 510 - 8;
            this._progressBar.y = 395 + 35;
            this._progressBar.setBg(ImagesConst.MountBarBg, true, 246, 13);
            this._progressBar.setProgress(ImagesConst.MountBar, true, 4, 4, 238, 13);
            this._progressBar.setLabel(BaseProgressBar.ProgressBarTextOnlyShowValue, 25);
            this._progressBar.isOverShowValue = true;
            this._progressBar.mouseChildren = false;
            this._progressBar.mouseEnabled = true;
            this._progressBar.toolTipData = this.getFashionAdvanceToolTipInfo;
            this.addChild(this._progressBar);
            this._consumeStuffTxt = UIFactory.gTextField(Language.getString(41293), 566, 464 - 4, 74, 20, this);
            this._consumeStuffName = UIFactory.gTextField("", 560, 482 - 4, 92, 20, this, GlobalStyle.textFormatZi);
            this._consumeItem = UICompomentPool.getUICompoment(BaseItem);
            this._consumeItem.x = 636;
            this._consumeItem.y = 460;
            this._consumeItem.isDragAble = false;
            this._consumeItem.isShowColorBg = true;
            this.addChild(this._consumeItem);
            this._consumeItem.setItemStyle(ItemStyleConst.Small);
            this._consumeNum = UIFactory.gTextField("", 683, 476 - 5, 37, 20, this);
            this._consumeBagNum = UIFactory.gTextField("", 683 - 21, 476 - 5 + 10, 25, 20, this, GlobalStyle.textFormatBai.setSize(10));
            this._commonAdvanceBtn = UIFactory.gLoadingButton(ResFileConst.SystemAdvanceBtn, 515 + 21 - 16, 512 - 3, 114, 33, this);
            this._autoAdvanceBtn = UIFactory.gLoadingButton(ResFileConst.SystemAutoAdvanceBtn, 626 + 21 - 16, 512 - 3, 114, 33, this);
            this._autoAdvanceBtn.visible = true;
            this._cancelBtn = UIFactory.gLoadingButton(ResFileConst.CancelAdvanceBtn, 626 + 21 - 16, 512 - 3, 114, 33, this);
            this._cancelBtn.visible = false;
            this._commonAdvanceBtn.configEventListener(MouseEvent.CLICK, this.onAdvanceHandler);
            this._autoAdvanceBtn.configEventListener(MouseEvent.CLICK, this.onAdvanceHandler);
            this._cancelBtn.configEventListener(MouseEvent.CLICK, this.onAdvanceHandler);
            this._commonAdvanceBtn.configEventListener(MouseEvent.MOUSE_OVER, this.onAttrOverHandler);
            this._autoAdvanceBtn.configEventListener(MouseEvent.MOUSE_OVER, this.onAttrOverHandler);
            this._cancelBtn.configEventListener(MouseEvent.MOUSE_OVER, this.onAttrOverHandler);
            this._commonAdvanceBtn.configEventListener(MouseEvent.MOUSE_OUT, this.onAttrOutHandler);
            this._autoAdvanceBtn.configEventListener(MouseEvent.MOUSE_OUT, this.onAttrOutHandler);
            this._cancelBtn.configEventListener(MouseEvent.MOUSE_OUT, this.onAttrOutHandler);
            this._autoBuy = UIFactory.checkBox(Language.getString(41294), 558 + 3, 561 - 10, 140, 28, this);
            this._autoBuy.configEventListener(MouseEvent.CLICK, this.onAutoBuyClickHandler);
            this._arrow = UICompomentPool.getUICompoment(SWFPlayer);
            this.updateActiveBtn();
            this.updateAll();
            this.addListeners();
            this.initAutoBuyState();
            this.initCurrSelCode();
            return;
        }// end function

        private function addListeners() : void
        {
            NetDispatcher.addCmdListener(ServerCommand.FashionInfoUpdate, this.onFashionInfoUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionClothEquipUpdate, this.onClothEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionWingEquipUpdate, this.onWingEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionWeaponEquipUpdate, this.onWeaponEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionFightSoulEquipUpdate, this.onFightSoulEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionFightMethodEquipUpdate, this.onFightMethodEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionDragonSoulEquipUpdate, this.onDragonSoulEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionHolyBookEquipUpdate, this.onHolyBookEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionWarShieldEquipUpdate, this.onWarShieldEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.FashionMonsterSoulEquipUpdate, this.onMonsterSoulEquipUpdate);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsChange, this.backPackItemChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.VipLevelUp, this.onVipLevelUpHandler);
            Dispatcher.addEventListener(EventName.FashionUpdateFashionSkill, this.onFashionSkillUpdate);
            Dispatcher.addEventListener(EventName.FashionActiveFashion, this.onActiveFashionHandler);
            NetDispatcher.addCmdListener(ServerCommand.FashionUpdateExpiredTime, this.onExpiredTimeUpdate);
            Dispatcher.addEventListener(EventName.FashionOnceAdvance, this.onFashionAdvanceCompl);
            Dispatcher.addEventListener(EventName.FashionAutoAdvance, this.onAutoAdvanceHandler);
            Dispatcher.addEventListener(EventName.FashionCancelAutoAdvance, this.onCancelAutoAdvance);
            _window.addEventListener(EventName.WindowDragEnd, this.onWindowDragEnd);
            return;
        }// end function

        private function removeListeners() : void
        {
            NetDispatcher.removeCmdListener(ServerCommand.FashionInfoUpdate, this.onFashionInfoUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.FashionClothEquipUpdate, this.onClothEquipUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.FashionWingEquipUpdate, this.onWingEquipUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.FashionFightSoulEquipUpdate, this.onFightSoulEquipUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.FashionFightMethodEquipUpdate, this.onFightMethodEquipUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.FashionDragonSoulEquipUpdate, this.onDragonSoulEquipUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.FashionWeaponEquipUpdate, this.onWeaponEquipUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsChange, this.backPackItemChangeHandler);
            NetDispatcher.removeCmdListener(ServerCommand.VipLevelUp, this.onVipLevelUpHandler);
            Dispatcher.removeEventListener(EventName.FashionUpdateFashionSkill, this.onFashionSkillUpdate);
            Dispatcher.removeEventListener(EventName.FashionActiveFashion, this.onActiveFashionHandler);
            NetDispatcher.removeCmdListener(ServerCommand.FashionUpdateExpiredTime, this.onExpiredTimeUpdate);
            Dispatcher.removeEventListener(EventName.FashionOnceAdvance, this.onFashionAdvanceCompl);
            Dispatcher.removeEventListener(EventName.FashionAutoAdvance, this.onAutoAdvanceHandler);
            Dispatcher.removeEventListener(EventName.FashionCancelAutoAdvance, this.onCancelAutoAdvance);
            if (_window)
            {
                _window.removeEventListener(EventName.WindowDragEnd, this.onWindowDragEnd);
            }
            return;
        }// end function

        protected function onBgLoadCompl(param1) : void
        {
            if (isDisposed)
            {
                return;
            }
            this._bg.bitmapData = param1.bitmapData as BitmapData;
            if (this._rect3d == null)
            {
                this.init3DRect();
            }
            this.add3dBg();
            this.initRoleModel();
            this._timeoutNum = setTimeout(this.setTimeoutFun, 500);
            return;
        }// end function

        private function setTimeoutFun() : void
        {
            clearTimeout(this._timeoutNum);
            this.removeAllModel();
            this.initRoleModel();
            return;
        }// end function

        protected function initHideState() : void
        {
            var _loc_1:* = Cache.instance.fashion.getFashionHideState(this._fashionType);
            this._hideBox.selected = _loc_1 == EFashionStatus._EFashionStatusHide ? (true) : (false);
            return;
        }// end function

        protected function initShapHideState() : void
        {
            var _loc_1:* = Cache.instance.fashion.getFashionShapState(this._fashionType);
            return;
        }// end function

        protected function initAutoBuyState() : void
        {
            this._autoBuy.selected = ClientSetting.local.getIsDone(FashionUtil.getIsDoneTypeByFashionType(this._fashionType));
            return;
        }// end function

        protected function initCurrSelCode() : void
        {
            if (this._data && this._data.advanceInfo)
            {
                this.updateCurrShap(this._data.advanceInfo.shapeCode);
                this.clearBtnState();
                this.updateSwitchBtnState();
                this.updateChangeBtnState();
            }
            return;
        }// end function

        protected function init3DRect() : void
        {
            this._rect3d = Rect3DManager.instance.registerWindow(true, new Rectangle(8 + 3, 35 + 2, 490, 546), _window);
            Rect3DManager.instance.windowShowHander(null, _window);
            return;
        }// end function

        protected function add3dBg() : void
        {
            if (this._rect3d)
            {
                this._rect3d.removeImg(this._img2d);
                this._img2d = new Img2D(null, this._bg.bitmapData, new Rectangle(0, 0, 490, 546), false);
                this._rect3d.addImg(this._img2d);
            }
            return;
        }// end function

        protected function initRoleModel() : void
        {
            return;
        }// end function

        protected function updateRoleModel(param1:int = 0) : void
        {
            return;
        }// end function

        protected function removeFightSoulEffectPlayer() : void
        {
            if (this._rect3d && this._fightSoulEffectPlayer)
            {
                this._rect3d.disposeObj3d(this._fightSoulEffectPlayer);
                this._fightSoulEffectPlayer = null;
            }
            return;
        }// end function

        protected function removeFightSoulModelPlayer() : void
        {
            if (this._rect3d && this._fightSoulModelPlayer)
            {
                this._rect3d.disposeObj3d(this._fightSoulModelPlayer);
                this._fightSoulModelPlayer = null;
            }
            return;
        }// end function

        protected function removeNextFightSoulEffectPlayer() : void
        {
            if (this._rect3d && this._nextFightSoulEffectPlayer)
            {
                this._rect3d.disposeObj3d(this._nextFightSoulEffectPlayer);
                this._nextFightSoulEffectPlayer = null;
            }
            return;
        }// end function

        protected function removeNextFightSoulModelPlayer() : void
        {
            if (this._rect3d && this._nextFightSoulModelPlayer)
            {
                this._rect3d.disposeObj3d(this._nextFightSoulModelPlayer);
                this._nextFightSoulModelPlayer = null;
            }
            return;
        }// end function

        protected function remove3D() : void
        {
            if (this._rect3d)
            {
                if (this._scale9gridImg2d)
                {
                    this._rect3d.disposeObj3d(this._scale9gridImg2d);
                    this._scale9gridImg2d = null;
                }
                if (this._img2d)
                {
                    this._rect3d.removeImg(this._img2d);
                    this._img2d = null;
                }
                if (this._roleModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._roleModelPlayer);
                    this._roleModelPlayer = null;
                }
                if (this._nextModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._nextModelPlayer);
                    this._nextModelPlayer = null;
                }
                if (this._fightSoulEffectPlayer)
                {
                    this._rect3d.disposeObj3d(this._fightSoulEffectPlayer);
                    this._fightSoulEffectPlayer = null;
                }
                if (this._fightSoulModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._fightSoulModelPlayer);
                    this._fightSoulModelPlayer = null;
                }
                if (this._nextFightSoulEffectPlayer)
                {
                    this._rect3d.disposeObj3d(this._nextFightSoulEffectPlayer);
                    this._nextFightSoulEffectPlayer = null;
                }
                if (this._nextFightSoulModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._nextFightSoulModelPlayer);
                    this._nextFightSoulModelPlayer = null;
                }
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
            }
            return;
        }// end function

        protected function removeAllModel() : void
        {
            return;
        }// end function

        protected function updateAll() : void
        {
            return;
        }// end function

        protected function onTurnPageClick(event:MouseEvent) : void
        {
            var _loc_2:String = null;
            if (event.target == this._turnLeftBtn)
            {
                (this._currSelCode - 1);
            }
            else if (event.target == this._turnRightBtn)
            {
                if (this._isRightTop)
                {
                    _loc_2 = FashionUtil.getFashionNameByType(this._data.type);
                    MsgManager.showRollTipsMsg(Language.getString(41295) + _loc_2);
                    return;
                }
                (this._currSelCode + 1);
            }
            this.clearBtnState();
            this.updateSwitchBtnState();
            this.updateChangeBtnState();
            this.updateRoleModel();
            this.updateFashionName();
            return;
        }// end function

        protected function onChangeClick(event:MouseEvent) : void
        {
            if (this._data.advanceInfo.shapeCode > 100)
            {
                MsgManager.showRollTipsMsg(Language.getString(41296), MsgRollTipsType.msgRollTips3);
                return;
            }
            GameProxy.fashion.changeShape(this._currSelCode, this._data.type);
            return;
        }// end function

        protected function clearBtnState() : void
        {
            this._turnLeftBtn.filterEnabled = true;
            this._turnRightBtn.filterEnabled = true;
            this._isRightTop = false;
            this._sharpBtn.filterEnabled = true;
            return;
        }// end function

        protected function updateCurrShap(param1:int = 0) : void
        {
            this._currSelCode = param1 == 0 || param1 > 10 ? (this._data.advanceInfo.code) : (param1);
            return;
        }// end function

        protected function updateFashionName() : void
        {
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_4:TPlayerModel = null;
            if (this._currSelCode == 0)
            {
                var _loc_5:String = this;
                var _loc_6:* = this._currSelCode + 1;
                _loc_5._currSelCode = _loc_6;
            }
            var _loc_1:* = MountConfig.instance.getFashionInfoByCode(this._data.type, this._currSelCode);
            if (_loc_1)
            {
                if (this._fashionType == EFashionType._EFashionWeapon)
                {
                    _loc_2 = Cache.instance.role.entityInfo.career;
                    _loc_3 = Cache.instance.role.entityInfo.sex;
                    _loc_4 = PlayerModelConfig.instance.getModelInfo(ModelType.WEAPONS, _loc_1.modelId, _loc_3, _loc_2);
                    if (_loc_4)
                    {
                        this._fashionName.text = _loc_4.name;
                    }
                }
                else
                {
                    this._fashionName.text = _loc_1.name;
                }
            }
            return;
        }// end function

        protected function updateEquip() : void
        {
            return;
        }// end function

        protected function updateSkill() : void
        {
            var _loc_3:String = null;
            var _loc_4:DataProvider = null;
            var _loc_5:FashionSkillData = null;
            var _loc_6:TSkill = null;
            var _loc_7:SkillInfo = null;
            var _loc_8:SkillInfo = null;
            var _loc_1:Array = [];
            var _loc_2:* = FashionUtil.getAllCodeDefaultSkills(this._data.type);
            for each (_loc_3 in _loc_2.keys)
            {
                
                _loc_5 = new FashionSkillData();
                _loc_5.openLevel = int(_loc_3);
                _loc_5.isOpen = int(_loc_3) > this._data.advanceInfo.code ? (false) : (true);
                _loc_6 = SkillConfig.instance.getInfoById(_loc_2.getValue(int(_loc_3)) as int);
                if (_loc_6)
                {
                    _loc_7 = new SkillInfo();
                    _loc_7.tSkill = _loc_6;
                    _loc_5.defaultSkill = _loc_7;
                    _loc_8 = FashionUtil.getLearnedMaxLevelSkill(this._data.type, _loc_6.posType);
                    _loc_5.learnedSkill = _loc_8;
                    if (_loc_8)
                    {
                        _loc_5.isActive = true;
                    }
                }
                _loc_1.push(_loc_5);
            }
            _loc_4 = new DataProvider();
            _loc_4.addItems(_loc_1);
            this._skillList.dataProvider = _loc_4;
            this._skillList.drawNow();
            return;
        }// end function

        protected function initBtnState() : void
        {
            var _loc_1:* = Cache.instance.fashion.getFashionHideState(this._fashionType);
            if (_loc_1 < 0)
            {
                this._commonAdvanceBtn.visible = false;
                this._autoAdvanceBtn.visible = false;
                this._activeBtn.visible = true;
                this._progressBar.visible = false;
                this._unActiveTxt.visible = true;
                this._advanceInfoSpr.visible = false;
                this._consumeStuffTxt.text = Language.getString(41297);
            }
            else
            {
                this._commonAdvanceBtn.visible = true;
                this._autoAdvanceBtn.visible = true;
                this._activeBtn.visible = false;
                this._progressBar.visible = true;
                this._unActiveTxt.visible = false;
                if (!this._isFashionFullLevel)
                {
                    this._advanceInfoSpr.visible = true;
                }
                this._consumeStuffTxt.text = Language.getString(41298);
            }
            return;
        }// end function

        protected function updateLevelName() : void
        {
            var _loc_1:TMountConfig = null;
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            var _loc_5:TPlayerModel = null;
            if (this._data.advanceInfo)
            {
                _loc_1 = MountConfig.instance.getFashionInfoByCode(this._fashionType, this._data.advanceInfo.code);
                if (_loc_1)
                {
                    this._levelImg.imgUrl = "levelIcon_" + _loc_1.code + ".png";
                    if (this._fashionType == EFashionType._EFashionWeapon)
                    {
                        _loc_3 = Cache.instance.role.entityInfo.career;
                        _loc_4 = Cache.instance.role.entityInfo.sex;
                        _loc_5 = PlayerModelConfig.instance.getModelInfo(ModelType.WEAPONS, _loc_1.modelId, _loc_4, _loc_3);
                        if (_loc_5)
                        {
                            this._levelTxt.text = _loc_5.name;
                        }
                    }
                    else
                    {
                        this._levelTxt.text = _loc_1.name;
                    }
                    _loc_2 = 64 + this._levelTxt.textWidth;
                    this._levelSpr.x = 500 + (260 - _loc_2) / 2;
                }
            }
            return;
        }// end function

        protected function updateCombat() : void
        {
            return;
        }// end function

        protected function updateAttr() : void
        {
            return;
        }// end function

        protected function onAttrOverHandler(event:MouseEvent = null) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FashionShowHidePreviewAttr, true));
            TweenMax.to(this._equipSpr, 1, {alpha:0, ease:Quint.easeOut});
            this._isMouseOver = true;
            return;
        }// end function

        protected function onAttrOutHandler(event:MouseEvent = null) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FashionShowHidePreviewAttr, false));
            TweenMax.to(this._equipSpr, 1, {alpha:1, ease:Quint.easeOut});
            this._isMouseOver = false;
            return;
        }// end function

        protected function onClothEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onWingEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onWeaponEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onFightSoulEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onFightMethodEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onDragonSoulEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onHolyBookEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onWarShieldEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function onMonsterSoulEquipUpdate(param1:Object) : void
        {
            return;
        }// end function

        protected function updatePropItem() : void
        {
            return;
        }// end function

        protected function useItemHandler(event:MouseEvent) : void
        {
            return;
        }// end function

        protected function updatePropAmount() : void
        {
            return;
        }// end function

        protected function updateBtnState() : void
        {
            this.initBtnState();
            return;
        }// end function

        private function onActiveFashionHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as Boolean;
            this.activeFashion(_loc_2);
            return;
        }// end function

        protected function activeFashion(param1:Boolean) : void
        {
            var _loc_3:Array = null;
            var _loc_7:int = 0;
            var _loc_10:int = 0;
            var _loc_11:ItemInfo = null;
            var _loc_12:ShopItemData = null;
            var _loc_13:int = 0;
            var _loc_14:Boolean = false;
            var _loc_2:* = FashionUtil.getAdvanceTypeByFashionType(this._fashionType);
            var _loc_4:* = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, _loc_2);
            _loc_4.sort(ItemsUtil.sortItem);
            var _loc_5:* = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, EAdvanceType._EAdvanceTypeAllRoundUp);
            _loc_5.sort(ItemsUtil.sortItem);
            _loc_3 = _loc_4.concat(_loc_5);
            var _loc_6:* = this._data.baseInfo.openPropNum;
            var _loc_8:* = new Dictionary();
            var _loc_9:* = _loc_3.length;
            while (_loc_10 < _loc_9)
            {
                
                if (ItemsUtil.isPrescriOutTime(_loc_3[_loc_10] as ItemData))
                {
                }
                else if ((_loc_3[_loc_10] as ItemData).itemInfo.effectEx == 1)
                {
                }
                else if (this._data.baseInfo.code >= (_loc_3[_loc_10] as ItemData).itemInfo.effect)
                {
                    _loc_7 = _loc_7 + (_loc_3[_loc_10] as ItemData).itemAmount;
                    _loc_8[(_loc_3[_loc_10] as ItemData).uid] = (_loc_3[_loc_10] as ItemData).itemAmount;
                    if (_loc_7 >= _loc_6)
                    {
                        _loc_8[(_loc_3[_loc_10] as ItemData).uid] = (_loc_3[_loc_10] as ItemData).itemAmount - _loc_7 + _loc_6;
                        break;
                    }
                }
                _loc_10++;
            }
            if (_loc_7 >= _loc_6)
            {
                GameProxy.fashion.activeFashion(param1, this._data.type, _loc_8);
            }
            else
            {
                _loc_11 = ItemConfig.instance.getConfig(int(this._data.baseInfo.propConsume));
                if (this._autoBuy.selected)
                {
                    _loc_12 = ShopConfig.instance.getFastBuyItemByCode(_loc_11.bind ? (_loc_11.codeUnbind) : (_loc_11.code));
                    _loc_13 = _loc_12.prize * (_loc_6 - _loc_7);
                    _loc_14 = Cache.instance.role.enoughMoney(EPriceUnit._EPriceUnitGoldBind, _loc_13, null, false);
                    if (_loc_14)
                    {
                        GameProxy.fashion.activeFashion(param1, this._data.type, _loc_8);
                    }
                    else
                    {
                        this.showGiftToUse(_loc_11, _loc_6 - _loc_7);
                    }
                }
                else if (GuideController.currentGuideItemWin == ModuleType.Fashion)
                {
                    MsgManager.showMouseMsg(Language.getString(41287), MsgRollTipsType.msgRollTips3);
                    GameController.playerSystem.view.hide();
                    GuideController.currentGuideItemWin = null;
                }
                else
                {
                    this.showGiftToUse(_loc_11, _loc_6 - _loc_7);
                }
            }
            return;
        }// end function

        protected function onActiveHandler(event:MouseEvent) : void
        {
            this.activeFashion(this._autoBuy.selected);
            return;
        }// end function

        protected function onFashionInfoUpdate(param1:Object) : void
        {
            var _loc_2:* = param1 as SAttributeUpdate;
            this._data = Cache.instance.fashion.getFashionInfo(this._fashionType);
            if (_loc_2)
            {
                switch(_loc_2.attribute.value())
                {
                    case EEntityAttribute._EAttributeFashionCode:
                    {
                        this.updateAll();
                        this.onAdvanceSucc();
                        break;
                    }
                    case EEntityAttribute._EAttributeFashionShape:
                    {
                        this.updateChangeBtnState();
                        this.updateRoleModel();
                        break;
                    }
                    case EEntityAttribute._EAttributeFashionTotalTalentNum:
                    case EEntityAttribute._EAttributeFashionTotalGrowthNum:
                    {
                        this.updateAttr();
                        this.updateCombat();
                        break;
                    }
                    case EEntityAttribute._EAttributeFashionStatus:
                    {
                        this.updateBtnState();
                        this.updateRoleModel();
                        this.updateConsumeInfo();
                        break;
                    }
                    case EEntityAttribute._EAttributeFashionBless:
                    {
                        this.updateProgressInfo();
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            return;
        }// end function

        protected function onAdvanceSucc() : void
        {
            return;
        }// end function

        protected function backPackItemChangeHandler(param1:Object) : void
        {
            this.updatePropAmount();
            this.updateConsumeState();
            return;
        }// end function

        protected function onVipLevelUpHandler(param1:Object) : void
        {
            return;
        }// end function

        protected function onFashionSkillUpdate(event:DataEvent) : void
        {
            this.updateSkill();
            this.updateCombat();
            return;
        }// end function

        protected function getFashionAdvanceToolTipInfo() : ToolTipInfo
        {
            var _loc_1:BlessData = null;
            var _loc_2:Date = null;
            var _loc_3:int = 0;
            if (this._data)
            {
                _loc_1 = new BlessData();
                _loc_1.bless = this._data.advanceInfo.bless;
                _loc_1.blessClear = this._data.baseInfo.blessClear;
                _loc_2 = ClockManager.instance.nowDate;
                _loc_3 = Cache.instance.fashion.getFashionExpiredTime(this._data.type) - _loc_2.time / 1000;
                if (_loc_3 > 0)
                {
                    _loc_1.leftSeconds = _loc_3;
                }
                _loc_1.type = FashionUtil.getFashionNameByType(this._data.type);
                return new ToolTipInfo(TooltipType.Bless, _loc_1);
            }
            return null;
        }// end function

        protected function onAutoBuyClickHandler(event:MouseEvent) : void
        {
            if (this._autoBuy.selected == true)
            {
                ClientSetting.local.setIsDone(true, FashionUtil.getIsDoneTypeByFashionType(this._fashionType));
            }
            else
            {
                ClientSetting.local.setIsDone(false, FashionUtil.getIsDoneTypeByFashionType(this._fashionType));
            }
            return;
        }// end function

        protected function updateAdvanceInfo() : void
        {
            var _loc_2:String = null;
            var _loc_1:* = MountConfig.instance.getFashionInfoByCode(this._data.type, (this._data.baseInfo.code + 1));
            if (_loc_1)
            {
                _loc_2 = FashionUtil.getFashionNameByType(this._data.type);
                this._currLevel.text = "" + this._data.advanceInfo.code;
                this._nextLevel.text = "" + _loc_1.code;
                this._advanceInfoSpr.visible = true;
                this._fullLevelTip.text = "";
                this._commonAdvanceBtn.filterEnabled = true;
                this._autoAdvanceBtn.filterEnabled = true;
                this._cancelBtn.filterEnabled = true;
            }
            else
            {
                this._isFashionFullLevel = true;
                this._fullLevelTip.text = Language.getString(41299);
                this._advanceInfoSpr.visible = false;
                this._commonAdvanceBtn.filterEnabled = false;
                this._autoAdvanceBtn.filterEnabled = false;
                this._cancelBtn.filterEnabled = false;
            }
            return;
        }// end function

        protected function updateProgressInfo() : void
        {
            this._progressBar.setValue(this._data.advanceInfo.bless, this._data.baseInfo.blessMax);
            return;
        }// end function

        protected function updateConsumeInfo() : void
        {
            if (this._data.advanceInfo.state < 0)
            {
                this._consumeNum.text = "*" + this._data.baseInfo.openPropNum;
            }
            else
            {
                this._consumeNum.text = "*" + this._data.baseInfo.propNum;
            }
            this.updateConsumeState();
            if (this._data.advanceInfo.code == FashionConst.FashionAdvanceMaxLevel)
            {
                this._consumeNum.visible = false;
            }
            else
            {
                this._consumeNum.visible = true;
            }
            return;
        }// end function

        protected function updateConsumeState() : void
        {
            var _loc_4:Array = null;
            var _loc_5:Array = null;
            var _loc_6:Boolean = false;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:int = 0;
            var _loc_10:int = 0;
            var _loc_11:int = 0;
            var _loc_1:* = FashionUtil.getAdvanceTypeByFashionType(this._data.type);
            var _loc_2:* = Cache.instance.fashion.getFashionHideState(this._fashionType);
            var _loc_3:* = MountUtil.isHasBlessItem(_loc_1);
            if (_loc_2 >= 0 && _loc_3)
            {
                this._consumeItem.itemData = _loc_3;
                this._consumeStuffName.htmlText = ItemsUtil.getItemName(this._consumeItem.itemData, "[{0}]");
                this._consumeBagNum.htmlText = HTMLUtil.addColor(this._consumeItem.amount + "", GlobalStyle.colorBai);
                this._consumeBagNum.x = this._consumeItem.x + (this._consumeItem.width - this._consumeBagNum.textWidth) - 7;
                this._consumeNum.text = "*" + 1;
                this._consumeItem.bitmapEnable = true;
            }
            else
            {
                _loc_4 = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, _loc_1);
                _loc_5 = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, EAdvanceType._EAdvanceTypeAllRoundUp);
                _loc_10 = this._data.baseInfo.propNum;
                while (_loc_11 < _loc_4.length)
                {
                    
                    if (ItemsUtil.isPrescriOutTime(_loc_4[_loc_11] as ItemData))
                    {
                    }
                    else if ((_loc_4[_loc_11] as ItemData).itemInfo.effectEx == 1)
                    {
                    }
                    else if (this._data.baseInfo.code >= (_loc_4[_loc_11] as ItemData).itemInfo.effect)
                    {
                        _loc_7 = _loc_7 + (_loc_4[_loc_11] as ItemData).itemAmount;
                    }
                    _loc_11++;
                }
                _loc_11 = 0;
                while (_loc_11 < _loc_5.length)
                {
                    
                    _loc_8 = _loc_8 + (_loc_5[_loc_11] as ItemData).itemAmount;
                    _loc_11++;
                }
                _loc_9 = _loc_7 + _loc_8;
                if (_loc_9 >= _loc_10)
                {
                    _loc_6 = true;
                    if (AutoGuideCache.isGuideFuncPanel && (this._data.type == EFashionType._EFashionClothes || this._data.type == EFashionType._EFashionWeapon))
                    {
                        this.addArrow();
                    }
                    if (_loc_7 > 0)
                    {
                        this._consumeItem.itemData = new ItemData(int(this._data.baseInfo.propConsume));
                        this._consumeStuffName.text = Language.getStringByParam(41300, FashionUtil.getFashionNameByType(this._data.type));
                    }
                    else
                    {
                        this._consumeItem.itemData = new ItemData(410540001);
                        this._consumeStuffName.text = Language.getString(41301);
                    }
                    this._consumeBagNum.htmlText = HTMLUtil.addColor(_loc_9 + "", GlobalStyle.colorBai);
                    this._consumeBagNum.x = this._consumeItem.x + (this._consumeItem.width - this._consumeBagNum.textWidth) - 7;
                }
                else
                {
                    this._consumeItem.itemData = new ItemData(int(this._data.baseInfo.propConsume));
                    this._consumeBagNum.htmlText = HTMLUtil.addColor(_loc_9 + "", GlobalStyle.colorHong);
                    this._consumeBagNum.x = this._consumeItem.x + (this._consumeItem.width - this._consumeBagNum.textWidth) - 7;
                    this._consumeStuffName.text = Language.getStringByParam(41300, FashionUtil.getFashionNameByType(this._data.type));
                }
                if (this._data.advanceInfo.state < 0)
                {
                    this._consumeNum.text = "*" + this._data.baseInfo.openPropNum;
                }
                else
                {
                    this._consumeNum.text = "*" + this._data.baseInfo.propNum;
                }
                if (this._data.advanceInfo.code == FashionConst.FashionAdvanceMaxLevel)
                {
                    this._consumeNum.visible = false;
                }
                else
                {
                    this._consumeNum.visible = true;
                }
                this._consumeItem.bitmapEnable = _loc_6;
            }
            return;
        }// end function

        protected function updateSwitchBtnState() : void
        {
            if (this._currSelCode <= 1)
            {
                this._turnLeftBtn.filterEnabled = false;
            }
            if (this._currSelCode >= this._data.advanceInfo.code || this._currSelCode == FashionConst.FashionAdvanceMaxLevel)
            {
                this._turnRightBtn.filterEnabled = false;
                if (this._currSelCode != FashionConst.FashionAdvanceMaxLevel)
                {
                    this._turnRightBtn.mouseEnabled = true;
                    this._isRightTop = true;
                }
            }
            return;
        }// end function

        protected function updateChangeBtnState() : void
        {
            if (this._data.advanceInfo.code < 4)
            {
                this._sharpBtn.visible = false;
                return;
            }
            this._sharpBtn.visible = true;
            if (this._currSelCode == this._data.advanceInfo.shapeCode || this._currSelCode > this._data.advanceInfo.code)
            {
                this._sharpBtn.filterEnabled = false;
            }
            else
            {
                this._sharpBtn.filterEnabled = true;
            }
            return;
        }// end function

        protected function updateCd() : void
        {
            var _loc_1:Number = NaN;
            if (!this._data)
            {
                return;
            }
            switch(this._data.type)
            {
                case EFashionType._EFashionClothes:
                {
                    this._cdType = "ClothBlessClearCd";
                    break;
                }
                case EFashionType._EFashionWing:
                {
                    this._cdType = "WingBlessClearCd";
                    break;
                }
                case EFashionType._EFashionWeapon:
                {
                    this._cdType = "WeaponBlessClearCd";
                    break;
                }
                case EFashionType._EFashionFightSoul:
                {
                    this._cdType = "FightSoulBlessClearCd";
                    break;
                }
                case EFashionType._EFashionFightMethod:
                {
                    this._cdType = "FightMethodBlessClearCd";
                    break;
                }
                case EFashionType._EFashionDragonSoul:
                {
                    this._cdType = "DragonSoulBlessClearCd";
                    break;
                }
                default:
                {
                    break;
                }
            }
            if (this._data.baseInfo.blessClear && this._data.advanceInfo.bless > 0)
            {
                _loc_1 = this._data.advanceInfo.lastAdvanceSuccessDt.time - ClockManager.instance.nowDate.time;
                if (_loc_1 > 0)
                {
                    if (this._cdData == null)
                    {
                        this._cdData = Cache.instance.cd.registerCDData(CDDataType.publicCD, this._cdType, this._cdData);
                    }
                    this._cdData.totalTime = _loc_1;
                    this._cdData.beginTime = 0;
                    this._cdData.startCoolDown();
                    this._cdData.addFinishCallback(this.clearBless);
                }
                else
                {
                    this.clearBless();
                }
            }
            else if (this._cdData)
            {
                this._cdData.dispose();
                Cache.instance.cd.unregisterCDData(CDDataType.publicCD, this._cdType);
                this._cdData = null;
            }
            return;
        }// end function

        private function clearBless() : void
        {
            Cache.instance.fashion.clearBless(this._data.type);
            this.updateProgressInfo();
            if (this._cdData)
            {
                this._cdData.dispose();
                Cache.instance.cd.unregisterCDData(CDDataType.publicCD, this._cdType);
                this._cdData = null;
            }
            return;
        }// end function

        private function onClearBlessHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            if (_loc_2 == this._data.type)
            {
                this.updateProgressInfo();
            }
            return;
        }// end function

        private function onExpiredTimeUpdate(param1:Object) : void
        {
            this.updateCd();
            return;
        }// end function

        protected function onAdvanceHandler(event:MouseEvent) : void
        {
            var _loc_2:String = null;
            this._isStopAdvance = false;
            if (this._data.advanceInfo.code == FashionConst.FashionAdvanceMaxLevel)
            {
                _loc_2 = FashionUtil.getFashionNameByType(this._data.type);
                return MsgManager.showRollTipsMsg(_loc_2 + Language.getString(41302));
            }
            if (event.target == this._commonAdvanceBtn)
            {
                this._isAutoAdvance = false;
                this.cancelAutoAdvance();
                this.fashionAdvance(this._isAutoAdvance);
            }
            else if (event.target == this._autoAdvanceBtn)
            {
                this._cancelBtn.visible = true;
                this._autoAdvanceBtn.visible = false;
                this._isAutoAdvance = true;
                this._callLaterId = CallLater.setCallLater(this.fashionAdvance, 0.5, this._isAutoAdvance);
            }
            else if (event.target == this._cancelBtn)
            {
                this.cancelAutoAdvance();
            }
            return;
        }// end function

        private function fashionAdvance(param1:Boolean) : void
        {
            var _loc_5:Array = null;
            var _loc_6:Array = null;
            var _loc_7:Array = null;
            var _loc_8:int = 0;
            var _loc_9:int = 0;
            var _loc_10:int = 0;
            var _loc_11:int = 0;
            var _loc_12:ItemInfo = null;
            var _loc_13:int = 0;
            var _loc_14:Boolean = false;
            if (this._isStopAdvance)
            {
                return;
            }
            if (this._data == null)
            {
                return;
            }
            var _loc_2:* = FashionUtil.getAdvanceTypeByFashionType(this._fashionType);
            var _loc_3:* = new Dictionary();
            var _loc_4:* = MountUtil.isHasBlessItem(_loc_2);
            if (_loc_4)
            {
                _loc_3[_loc_4.serverData.uid] = 1;
            }
            else
            {
                _loc_6 = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, _loc_2);
                _loc_6.sort(ItemsUtil.sortItem);
                _loc_7 = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, EAdvanceType._EAdvanceTypeAllRoundUp);
                _loc_7.sort(ItemsUtil.sortItem);
                _loc_5 = _loc_6.concat(_loc_7);
                _loc_8 = this._data.baseInfo.propNum;
                _loc_10 = _loc_5.length;
                while (_loc_11 < _loc_10)
                {
                    
                    if (ItemsUtil.isPrescriOutTime(_loc_5[_loc_11] as ItemData))
                    {
                    }
                    else if (this._data.baseInfo.code >= (_loc_5[_loc_11] as ItemData).itemInfo.effect)
                    {
                        _loc_9 = _loc_9 + (_loc_5[_loc_11] as ItemData).itemAmount;
                        _loc_3[(_loc_5[_loc_11] as ItemData).uid] = (_loc_5[_loc_11] as ItemData).itemAmount;
                        if (_loc_9 >= _loc_8)
                        {
                            _loc_3[(_loc_5[_loc_11] as ItemData).uid] = (_loc_5[_loc_11] as ItemData).itemAmount - _loc_9 + _loc_8;
                            break;
                        }
                    }
                    _loc_11++;
                }
            }
            if (_loc_4 || _loc_9 >= _loc_8)
            {
                GameProxy.fashion.advance(this._autoBuy.selected, this._data.type, _loc_3, param1);
            }
            else
            {
                _loc_12 = ItemConfig.instance.getConfig(int(this._data.baseInfo.propConsume));
                _loc_13 = ShopConfig.instance.getFastBuyItemByCode(_loc_12.bind ? (_loc_12.codeUnbind) : (_loc_12.code)).prize * (_loc_8 - _loc_9);
                _loc_14 = Cache.instance.role.enoughMoney(EPriceUnit._EPriceUnitGoldBind, _loc_13, null, false);
                if (this._autoBuy.selected)
                {
                    if (_loc_14)
                    {
                        GameProxy.fashion.advance(this._autoBuy.selected, this._data.type, _loc_3, param1);
                    }
                    else
                    {
                        this.showGiftToUse(_loc_12, _loc_8 - _loc_9);
                    }
                }
                else if (GuideController.currentGuideItemWin == ModuleType.Fashion)
                {
                    MsgManager.showMouseMsg(Language.getString(41287), MsgRollTipsType.msgRollTips3);
                    if (param1)
                    {
                        this.cancelAutoAdvance();
                    }
                    GameController.playerSystem.view.hide();
                    GuideController.currentGuideItemWin = null;
                }
                else
                {
                    this.showGiftToUse(_loc_12, _loc_8 - _loc_9);
                }
            }
            if (AutoGuideCache.isGuideFuncPanel && this._isAddArrow)
            {
                this.removeArrow();
                AutoGuideCache.isGuideFuncPanel = false;
                GameController.playerSystem.view.hide();
            }
            return;
        }// end function

        private function showGiftToUse(param1:ItemInfo, param2:int) : void
        {
            if (GiftsUtil.isCanUseFreeGift(param1.group, param1.category, param1.type, int.MAX_VALUE, EGiftBag._EGiftBagFix))
            {
                MsgManager.showRollTipsMsg(Language.getString(41303));
                if (this._isAutoAdvance)
                {
                    this.cancelAutoAdvance();
                }
                return;
            }
            else
            {
                if (BuyGiftItemWin.isAutoBuy)
                {
                    BuyGiftItemWin.isNeedTobuyCurTime = true;
                    Dispatcher.addEventListener(EventName.ShopBuyItemFail, this.shopBuyItemFail);
                    NetDispatcher.addCmdListener(ServerCommand.BackPackItemsAdd, this.keepLevelUp);
                }
                else
                {
                    MsgManager.showMouseMsg(Language.getString(41287), MsgRollTipsType.msgRollTips3);
                    if (this._isAutoAdvance)
                    {
                        this.cancelAutoAdvance();
                    }
                }
                BuyGiftItemWin.instance.setBuyData(param1.code, 2, param2, _window.x + _window.width + 5, _window.y - 3);
            }
            return;
        }// end function

        private function keepLevelUp(param1:Array) : void
        {
            var _loc_2:* = param1[0] as ItemData;
            if (ItemsUtil.isFashionAdvanceProp(_loc_2))
            {
                Dispatcher.removeEventListener(EventName.ShopBuyItemFail, this.shopBuyItemFail);
                NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.keepLevelUp);
                this.fashionAdvance(this._isAutoAdvance);
            }
            return;
        }// end function

        private function shopBuyItemFail(event:DataEvent) : void
        {
            if (this._isAutoAdvance)
            {
                this.cancelAutoAdvance();
            }
            return;
        }// end function

        private function cancelAutoAdvance() : void
        {
            if (this._cancelBtn)
            {
                this._cancelBtn.visible = false;
            }
            if (this._autoAdvanceBtn)
            {
                this._autoAdvanceBtn.visible = true;
            }
            Dispatcher.removeEventListener(EventName.ShopBuyItemFail, this.shopBuyItemFail);
            NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.keepLevelUp);
            this._isAutoAdvance = false;
            return;
        }// end function

        private function onAutoAdvanceHandler(event:DataEvent) : void
        {
            this.fashionAdvance(this._isAutoAdvance);
            return;
        }// end function

        private function onCancelAutoAdvance(event:DataEvent) : void
        {
            if (this._isAutoAdvance)
            {
                this.cancelAutoAdvance();
            }
            return;
        }// end function

        protected function onFashionAdvanceCompl(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            this._isCommonAdvance = _loc_2 == 0 ? (true) : (false);
            return;
        }// end function

        private function addArrow() : void
        {
            FashionUtil.addArrow(this._arrow, _window.contentTopOf3DSprite, this._commonAdvanceBtn.x - 10, this._commonAdvanceBtn.y + 18 + 4);
            this._isAddArrow = true;
            EffectManager.glowFilterReg(this._commonAdvanceBtn, null, 0);
            return;
        }// end function

        private function removeArrow() : void
        {
            FashionUtil.removeArrow(this._arrow);
            this._isAddArrow = false;
            EffectManager.glowFilterUnReg(this._commonAdvanceBtn);
            return;
        }// end function

        protected function onWindowDragEnd(event:Event) : void
        {
            return;
        }// end function

        protected function onClickTurnBtn(event:MouseEvent) : void
        {
            return;
        }// end function

        protected function stopTurning(event:MouseEvent = null) : void
        {
            return;
        }// end function

        private function updateActiveBtn() : void
        {
            if (Cache.instance.openServerSevenDay.getTargetTypeName() == FashionUtil.getFashionNameByType(this._fashionType))
            {
                if (this._servenActivitiesBtn == null)
                {
                    this._servenActivitiesBtn = UIFactory.gLoadingButton(ResFileConst.sevenDayActiveBtn, 636 + 66, 459, 44, 44, this);
                }
                this._servenActivitiesBtn.configEventListener(MouseEvent.CLICK, this.openServenDayWin);
            }
            else if (this._servenActivitiesBtn)
            {
                this._servenActivitiesBtn.removeEventListener(MouseEvent.CLICK, this.openServenDayWin);
                this._servenActivitiesBtn.dispose();
                this._servenActivitiesBtn = null;
            }
            return;
        }// end function

        private function openServenDayWin(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.RebateOpenServerSevenDayModule, null));
            return;
        }// end function

        public function get fashionType() : int
        {
            return this._fashionType;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            Dispatcher.removeEventListener(EventName.ShopBuyItemFail, this.shopBuyItemFail);
            NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.keepLevelUp);
            this._bg.dispose(param1);
            this._skillList.dispose(param1);
            this._rotate3d.dispose(param1);
            this._combat.dispose(param1);
            this._attrList.dispose(param1);
            this._levelTxt.dispose();
            this._currCombatTxt.dispose();
            if (this._hideBox)
            {
                this._hideBox.dispose();
            }
            this._skillLabel.dispose();
            this._growthItem.dispose();
            this._talentItem.dispose();
            this._equipList.dispose();
            this._fashionGrowthUseBtn.dispose();
            this._fashionTalentUseBtn.dispose();
            this._bg = null;
            this._skillList = null;
            this._rotate3d = null;
            this._combat = null;
            this._attrList = null;
            this._levelTxt = null;
            this._data = null;
            this._currCombatTxt = null;
            this._hideBox = null;
            this._skillLabel = null;
            this._growthItem = null;
            this._talentItem = null;
            this._equipList = null;
            this._fashionGrowthUseBtn = null;
            this._fashionTalentUseBtn = null;
            this._fashionName.dispose();
            this._fashionName = null;
            this._turnLeftBtn.dispose();
            this._turnLeftBtn = null;
            this._turnRightBtn.dispose();
            this._turnRightBtn = null;
            this._leftEquipBg.dispose();
            this._leftEquipBg = null;
            this._rightEquipBg.dispose();
            this._rightEquipBg = null;
            this._sharpBtn.dispose();
            this._sharpBtn = null;
            this._advanceTitle.dispose();
            this._advanceTitle = null;
            this._progressBar.dispose();
            this._progressBar = null;
            this._consumeStuffName.dispose();
            this._consumeStuffName = null;
            this._consumeItem.dispose();
            this._consumeItem = null;
            this._commonAdvanceBtn.dispose();
            this._commonAdvanceBtn = null;
            this._autoAdvanceBtn.dispose();
            this._autoAdvanceBtn = null;
            this._cancelBtn.dispose();
            this._cancelBtn = null;
            this._autoBuy.dispose();
            this._autoBuy = null;
            this._consumeNum.dispose();
            this._consumeNum = null;
            this._levelUpArrow.dispose();
            this._levelUpArrow = null;
            this._equipSpr.dispose();
            this._equipSpr = null;
            this._consumeStuffTxt.dispose();
            this._consumeStuffTxt = null;
            this._unActiveTxt.dispose();
            this._unActiveTxt = null;
            this._arrow.dispose();
            this._arrow = null;
            this._currAttrTxt.dispose();
            this._currAttrTxt = null;
            this._advanceLevelBg1.dispose();
            this._advanceLevelBg1 = null;
            this._advanceLevelBg2.dispose();
            this._advanceLevelBg2 = null;
            this._advanceArrow.dispose();
            this._advanceArrow = null;
            this._currLevel.dispose();
            this._currLevel = null;
            this._nextLevel.dispose();
            this._nextLevel = null;
            this._advanceInfoSpr.dispose();
            this._advanceInfoSpr = null;
            this._beforeAdvance.dispose();
            this._beforeAdvance = null;
            this._afterAdvance.dispose();
            this._afterAdvance = null;
            this._currLevelName.dispose();
            this._currLevelName = null;
            this._nextLevelName.dispose();
            this._nextLevelName = null;
            this._upCombatArrow.dispose();
            this._upCombatArrow = null;
            this._upCombat.dispose();
            this._upCombat = null;
            this._growthOpenTip.dispose();
            this._growthOpenTip = null;
            this._talentOpenTip.dispose();
            this._talentOpenTip = null;
            this._modelTurnLeftBtn.dispose();
            this._modelTurnLeftBtn = null;
            this._modelTurnRightBtn.dispose();
            this._modelTurnRightBtn = null;
            this._levelImg.dispose();
            this._levelImg = null;
            this._levelSpr.dispose();
            this._levelSpr = null;
            this._fullLevelTip.dispose();
            this._fullLevelTip = null;
            this._consumeBagNum.dispose();
            this._consumeBagNum = null;
            if (this._servenActivitiesBtn)
            {
                this._servenActivitiesBtn.dispose(param1);
                this._servenActivitiesBtn = null;
            }
            if (this._fashionSharpEquip)
            {
                this._fashionSharpEquip.dispose();
                this._fashionSharpEquip = null;
            }
            if (this._wardrobeEnterBtn)
            {
                this._wardrobeEnterBtn.dispose();
                this._wardrobeEnterBtn = null;
            }
            this.remove3D();
            this.removeListeners();
            if (!FashionActiveTipWin.instance.isHide)
            {
                FashionActiveTipWin.instance.hide();
            }
            if (!BuyItemWin.instance.isHide)
            {
                BuyItemWin.instance.hide();
            }
            if (BuyGiftItemWin.isViewShow)
            {
                BuyGiftItemWin.instance.hide();
            }
            if (this._cdData)
            {
                this._cdData.dispose();
                Cache.instance.cd.unregisterCDData(CDDataType.publicCD, this._cdType);
                this._cdData = null;
            }
            this._cdType = null;
            this._currAdvanceAttrData.length = 0;
            this._currSelCode = 0;
            this._timeoutNum = 0;
            this._isRightTop = false;
            this._isAutoAdvance = false;
            this._isStopAdvance = true;
            this._isCommonAdvance = false;
            this._isAddArrow = false;
            this._isMouseOver = false;
            this._isFashionFullLevel = false;
            super.disposeImpl(param1);
            return;
        }// end function

        public static function getBgName(param1:int) : String
        {
            var _loc_2:String = null;
            switch(param1)
            {
                case EFashionType._EFashionClothes:
                case EFashionType._EFashionWing:
                {
                    _loc_2 = ImagesConst.FashionPanelBg;
                    break;
                }
                case EFashionType._EFashionWeapon:
                case EFashionType._EFashionFightSoul:
                case EFashionType._EFashionFightMethod:
                case EFashionType._EFashionDragonSoul:
                case EAdvanceComponentType._EAdvanceComponentTypeHolyBook:
                case EAdvanceComponentType._EAdvanceComponentTypeWarShield:
                {
                    _loc_2 = ImagesConst.FashionPanelBg2;
                    break;
                }
                case EAdvanceComponentType._EAdvanceComponentTypeMonsterSoul:
                {
                    _loc_2 = ImagesConst.FashionPanelBg3;
                    break;
                }
                default:
                {
                    break;
                }
            }
            return _loc_2;
        }// end function

    }
}
